package com.itheima;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class UserServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        String uri = req.getRequestURI();
        String methodName = uri.substring(uri.lastIndexOf("/") + 1);
        if ("login".equals(methodName)){
            login(req,resp);
        }else if("regist".equals(methodName)){
            regist(req,resp);
        }else if("check".equals(methodName)){
            check(req,resp);
        }
    }

    private void check(HttpServletRequest req, HttpServletResponse resp) {
        System.out.println("check....");
    }

    private void regist(HttpServletRequest req, HttpServletResponse resp) {
        System.out.println("regist...");
    }

    private void login(HttpServletRequest req, HttpServletResponse resp) {
        System.out.println("login...");
    }
}
